package com.teach.demo02;

/**
 * <pre>
 * -
 * Author : J.L.Zhou
 * E-Mail : 2233875735@qq.com
 * Tel : 151 1104 7708
 * Date : 2021-04-06 10:55
 * Version : 1.0
 * Copyright 2021 jlzhou.top Inc. All rights reserved.
 * Warning: this content is only for internal circulation of the company.
 *          It is forbidden to divulge it or use it for other commercial purposes.
 * </pre>
 **/
public class Test1 {
  public static void main(String[] args) {
    Person p = null;
//    p = new Person();
    p = new Student();
    p.eating();
//    p.study();

    Student s = null;
    s = (Student) p;
//    Undergraduate u = null;//错误的
//    u = (Undergraduate)p;

    p = new Undergraduate();
    s = (Student) p;

    p = new Student();
    System.out.println(p instanceof Object);
    System.out.println(p instanceof Person);
    System.out.println(p instanceof Student);
    System.out.println(p instanceof Undergraduate);

  }
}
